package com.zhangxi.mapper;

import com.zhangxi.entity.SetMealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ClassName: SetMealDishMapper
 * Package: com.zhangxi.mapper
 */
@Mapper
public interface SetMealDishMapper {

    /**
     * 根据菜品的id查询套餐的id
     *
     * @param ids
     * @return
     */
    List<Long> getSetMealIdsByDishIds(List<Long> ids);


    /**
     * 批量向套餐菜品表插入数据
     *
     * @param setMealDishes
     */
    void insertBatch(List<SetMealDish> setMealDishes);

    /**
     * 根据套餐id查询出菜品信息
     * @param setMealDishId 套餐id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setMealDishId}")
    List<SetMealDish> getSetMealDishBySetMealId(Long setMealDishId);

    /**
     * 根据套餐id删除套餐菜品表中的数据
     * @param setMealId 套餐id
     */
    @Delete("delete  from setmeal_dish where setmeal_id = #{setMealId}")
    void deleteBySetMealId(Long setMealId);
}
